package com.itheima.test;


import com.alibaba.fastjson.JSONObject;
import org.junit.Test;

import java.util.*;
import java.util.stream.Collectors;

public class NoSpring {

    @Test
    public void test11(){
        Calendar c = Calendar.getInstance();
        c.setTime(new Date());
        c.add(Calendar.DAY_OF_MONTH, 5);
        System.out.println(c.getTime());
    }

    @Test
    public void test22(){

        String json="{\"flows\":[{\"num\":1,\"pos\":1,\"subItemId\":\"\",\"subItemName\":\"子项1 \",\"post\":[{\"id\":\"767107247930085376\",\"dep\":\"-1\",\"key\":\"proj_she_ji_zhu_chi_ren\",\"sys\":\"\",\"name\":\"设计主持人\",\"depKey\":\"\",\"bussType\":\"task\"}],\"tips\":null,\"type\":\"in_chapter_approval\",\"uuid\":\"83f5214d-7def-401a-9967-e5e2b76a826c\",\"notes\":\"审批意见\",\"title\":\"标题\",\"users\":{\"faqiren\":[{\"uid\":\"7\",\"depId\":null,\"depKey\":null,\"roleId\":null,\"nodeNum\":null,\"roleKey\":\"zhuanye_fuze_ren\",\"userName\":\"佘颖\",\"operateType\":null}],\"tuDangList\":[{\"uid\":\"11\",\"depId\":null,\"depKey\":null,\"roleId\":null,\"nodeNum\":null,\"roleKey\":\"zhuanye_fuze_ren\",\"userName\":\"佘颖\",\"operateType\":null},{\"uid\":\"12\",\"depId\":null,\"depKey\":null,\"roleId\":null,\"nodeNum\":null,\"roleKey\":\"zhuanye_fuze_ren\",\"userName\":\"佘颖\",\"operateType\":null}],\"shejizhuchirenList\":[{\"uid\":\"21\",\"depId\":null,\"depKey\":null,\"roleId\":null,\"nodeNum\":null,\"roleKey\":\"zhuanye_fuze_ren\",\"userName\":\"佘颖\",\"operateType\":null},{\"uid\":\"22\",\"depId\":null,\"depKey\":null,\"roleId\":null,\"nodeNum\":null,\"roleKey\":\"zhuanye_fuze_ren\",\"userName\":\"佘颖\",\"operateType\":null}],\"xiangmujingliList\":[{\"uid\":\"71\",\"depId\":null,\"depKey\":null,\"roleId\":null,\"nodeNum\":null,\"roleKey\":\"zhuanye_fuze_ren\",\"userName\":\"佘颖\",\"operateType\":null},{\"uid\":\"72\",\"depId\":null,\"depKey\":null,\"roleId\":null,\"nodeNum\":null,\"roleKey\":\"zhuanye_fuze_ren\",\"userName\":\"佘颖\",\"operateType\":null}],\"zhangrenList\":[{\"uid\":\"41\",\"depId\":null,\"depKey\":null,\"roleId\":null,\"nodeNum\":null,\"roleKey\":\"zhuanye_fuze_ren\",\"userName\":\"佘颖\",\"operateType\":null},{\"uid\":\"42\",\"depId\":null,\"depKey\":null,\"roleId\":null,\"nodeNum\":null,\"roleKey\":\"zhuanye_fuze_ren\",\"userName\":\"佘颖\",\"operateType\":null}]},\"createBy\":418543349070561281,\"formEdit\":\"no\",\"lastnode\":true,\"nodeType\":\"audit\",\"roleType\":\"faqiren\",\"updateBy\":418543349070561281,\"lastconts\":false,\"procInsId\":\"\",\"projectId\":\"-1\",\"usersinfo\":[],\"bussinessId\":\"500\",\"operateType\":\"projectRole\",\"performerId\":429210515106955265,\"projectName\":\"国贸cbd\",\"flowHandleId\":\"1\",\"approvalOrder\":\"meanwhile\",\"approvalSetting\":\"select\"}]}";


        JSONObject jsonObject = JSONObject.parseObject(json);

       List<JSONObject> ss= ( List<JSONObject> )jsonObject.get("flows");
        JSONObject o = ss.get(0);
        JSONObject users= (JSONObject)o.get("users");
        System.out.println(users);

        Set<String> strings = users.keySet();

        Iterator<String> iterator = strings.iterator();

        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
       /* for (int i = 0; i < users.size(); i++) {
            List<JSONObject> userhaha= ( List<JSONObject> )users.get(i);
            for (int i1 = 0; i1 < userhaha.size(); i1++) {
                JSONObject jsonObject1 = userhaha.get(i1);
                System.out.println(jsonObject1);
            }
        }*/


    }


    @Test
    public void testHaah(){

        Set<String> set1 = new HashSet<>();
        Set<String> set2 = new HashSet<>();
        set1.add("aa");
        set1.add("bb");
        set2.add("aa");
        set1.removeAll(set2);
        System.out.println(set1);
    }

    @Test
    public void test5(){

        List<Map> list1 = new ArrayList<Map>();
      Map map=  new HashMap();
      map.put("1","a");
        Map map2=  new HashMap();
        map2.put("2","b");



        Map map3=  new HashMap();
        map3.put("2","r");
        list1.add(map);
        list1.add(map2);


        List<Map> list2 = new ArrayList<Map>();
        list2.add(map);
        list2.add(map3);


        // 差集 (list1 - list2)
        List<Map> reduce1 = list1.stream().filter(item -> !list2.contains(item)).collect(Collectors.toList());
        System.out.println("---差集 reduce1 (list1 - list2)---");
        reduce1.parallelStream().forEach(System.out :: println);





    }

    @Test
    public void testss(){
          boolean a=true;
          boolean b=false;
        boolean b1 = a && b;

    }


    @Test
    public void test6(){


    }
}
